home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH1 / SRC / BOXSIZE.FRM < prev    next >
Text File  |  1995-12-14  |  2KB  |  88 lines

  1. VERSION 4.00
  2. Begin VB.Form BoxSizeForm 
  3.    Caption         =   "Box Size"
  4.    ClientHeight    =   3450
  5.    ClientLeft      =   3210
  6.    ClientTop       =   1710
  7.    ClientWidth     =   2760
  8.    Height          =   4140
  9.    Left            =   3150
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1000
  12.    ScaleLeft       =   -10
  13.    ScaleMode       =   0  'User
  14.    ScaleTop        =   100
  15.    ScaleWidth      =   10
  16.    Top             =   1080
  17.    Width           =   2880
  18.    Begin VB.PictureBox RightPict 
  19.       AutoRedraw      =   -1  'True
  20.       Height          =   975
  21.       Left            =   120
  22.       ScaleHeight     =   915
  23.       ScaleWidth      =   1515
  24.       TabIndex        =   1
  25.       Top             =   1800
  26.       Width           =   1575
  27.    End
  28.    Begin VB.PictureBox WrongPict 
  29.       AutoRedraw      =   -1  'True
  30.       Height          =   975
  31.       Left            =   120
  32.       ScaleHeight     =   915
  33.       ScaleWidth      =   1515
  34.       TabIndex        =   0
  35.       Top             =   120
  36.       Width           =   1575
  37.    End
  38.    Begin VB.Menu mnuFile 
  39.       Caption         =   "&File"
  40.       Begin VB.Menu mnuFileExit 
  41.          Caption         =   "E&xit"
  42.       End
  43.    End
  44. End
  45. Attribute VB_Name = "BoxSizeForm"
  46. Attribute VB_Creatable = False
  47. Attribute VB_Exposed = False
  48. Option Explicit
  49.  
  50. Private Sub Form_Load()
  51. Dim wid As Single
  52. Dim hgt As Single
  53. Dim extra_wid As Single
  54. Dim extra_hgt As Single
  55.  
  56.     ' Convert the desired width and height from
  57.     ' twips into the form's custom coordinates.
  58.     wid = Me.ScaleX(2500, 1, 0)
  59.     hgt = Me.ScaleY(1500, 1, 0)
  60.     
  61.     WrongPict.Width = wid
  62.     WrongPict.Height = hgt
  63.     WrongPict.Line (0, 750)-(1250, 0)
  64.     WrongPict.Line -(2500, 750)
  65.     WrongPict.Line -(1250, 1500)
  66.     WrongPict.Line -(0, 750)
  67.     
  68.     With RightPict
  69.         extra_wid = .Width - Me.ScaleX( _
  70.             .ScaleWidth, .ScaleMode, Me.ScaleMode)
  71.         extra_hgt = .Height - Me.ScaleY( _
  72.             .ScaleHeight, .ScaleMode, Me.ScaleMode)
  73.         .Width = wid + extra_wid
  74.         .Height = hgt + extra_hgt
  75.     End With
  76.     RightPict.Line (0, 750)-(1250, 0)
  77.     RightPict.Line -(2500, 750)
  78.     RightPict.Line -(1250, 1500)
  79.     RightPict.Line -(0, 750)
  80. End Sub
  81.  
  82.  
  83. Private Sub mnuFileExit_Click()
  84.     Unload Me
  85. End Sub
  86.  
  87.  
  88.